"""
URL configuration for ddingDine project.

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/5.1/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""

from django.contrib import admin
from django.urls import path
from django.views.static import serve
from django.conf import settings
from django.conf.urls.static import static
from main.views import *

urlpatterns = [
    path("admin/", admin.site.urls),
    path("get_or_create_user/", get_or_create_user),
    path("get_user_dine_data/", get_user_dine_data),
    path("ddine_meal/", ddine_meal),
    path("ddine_get_setting/", ddine_get_setting),
    path("ddine_setting/", ddine_setting),
    path("ddine_statistics/", ddine_statistics),
    path("export_statistics_data/", export_statistics_data),    # 统计页面
    path("get_ddine_detail/", get_ddine_detail),
    path("export_ddine_detail/", export_ddine_detail),
    path("export_ddine_no_detail/", export_ddine_no_detail),
    path("qc_code/", qc_code),

    # -----------
    # path(r'static/(?P<path>.*)', serve, {'document_root':settings.STATICFILES_DIRS}),
    # 上面注释的是static文件的路由，此处与media路由用作对比
    path(r'media/(?P<path>.*)', serve, {'document_root': settings.MEDIA_ROOT}, name='media'),
    # -----------
# 富文本没有这一行无法显示上传的图片, 同时也是 前后端的图片显示、文件、下载的URL
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
